package com.bjpowernode.web;

import com.bjpowernode.entity.TProductDO;
import com.bjpowernode.entity.TUserDO;
import com.bjpowernode.result.R;
import com.bjpowernode.service.TProductService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 *
 */
@RestController
@Slf4j
@RequestMapping("/api/product")
public class TProductController {

    @Resource
    private TProductService tProductService;

    @GetMapping("")
    public R loadProductDO() {
        log.info("获取所有产品名 和 id");
        // 查缓存 , 没有再查数据库 , 并存入数据库
        List<TProductDO> tProductDOList = tProductService.loadAllProductDo();
        return R.OK(tProductDOList);
    }

}
